<template>
  <div class="detail_container">
    <div class="head_title" v-if="!detailForm.uuid">创建体检详情</div>
    <div class="head_title" v-else-if="detailForm.uuid && isEdit">编辑体检详情</div>
    <div class="head_title" v-else-if="detailForm.uuid && !isEdit">查看体检详情</div>
    <el-divider></el-divider>
    <div class="px-20">
      <el-form :model="params" :disabled="detailForm.uuid && !isEdit" ref="expertForm" class="divForm" label-width="75px" :rules="rules" label-position="left" size="small">


        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="体检报告主键id" prop="personnelHeathId">
              <el-input v-model="params.personnelHeathId" placeholder="请输入体检报告主键id" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="体检机构编号" prop="bhkOrganCode">
              <el-input v-model="params.bhkOrganCode" placeholder="请输入体检机构编号" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="体检编号" prop="bhkCode">
              <el-input v-model="params.bhkCode" placeholder="请输入体检编号" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="社会信用代码" prop="institutionCode">
              <el-input v-model="params.institutionCode" placeholder="请输入社会信用代码" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="所属地区编码" prop="zoneCode">
              <el-input v-model="params.zoneCode" placeholder="请输入所属地区编码" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="企业名称" prop="crptName">
              <el-input v-model="params.crptName" placeholder="请输入企业名称" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="人员姓名" prop="personName">
              <el-input v-model="params.personName" placeholder="请输入人员姓名" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">

            <el-form-item label="性别" prop="sex">
              <el-select v-model="params.sex" placeholder="请选择性别" style="width: 100%;" >
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="身份证号" prop="idc">
              <el-input v-model="params.idc" placeholder="请输入身份证号" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="出生日期" prop="brth">
              <el-input v-model="params.brth" placeholder="请输入出生日期" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="年龄" prop="age">
              <el-input v-model="params.age" placeholder="请输入年龄" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="婚否" prop="isxmrd">
              <el-input v-model="params.isxmrd" placeholder="请输入婚否" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="人员联系电话" prop="lnkTel">
              <el-input v-model="params.lnkTel" placeholder="请输入人员联系电话" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="体检人员工作部门" prop="dpt">
              <el-input v-model="params.dpt" placeholder="请输入体检人员工作部门" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="人员工号" prop="wrkNum">
              <el-input v-model="params.wrkNum" placeholder="请输入人员工号" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="总工龄年数" prop="wrkLnt">
              <el-input v-model="params.wrkLnt" placeholder="请输入总工龄年数" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="总工龄月数" prop="wrkLntMonth">
              <el-input v-model="params.wrkLntMonth" placeholder="请输入总工龄月数" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="接害工龄年数" prop="tchBadRsnTim">
              <el-input v-model="params.tchBadRsnTim" placeholder="请输入接害工龄年数" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="接害工龄月数" prop="tchBadRsnMonth">
              <el-input v-model="params.tchBadRsnMonth" placeholder="请输入接害工龄月数" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="工种名称" prop="workName">
              <el-input v-model="params.workName" placeholder="请输入工种名称" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="在岗状态编码" prop="onguardState">
              <el-input v-model="params.onguardState" placeholder="请输入在岗状态编码" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="体检日期" prop="bhkDate">
              <el-input v-model="params.bhkDate" placeholder="请输入体检日期" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="体检结果" prop="bhkRst">
              <el-input v-model="params.bhkRst" placeholder="请输入体检结果" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="主检建议" prop="mhkAdv">
              <el-input v-model="params.mhkAdv" placeholder="请输入主检建议" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="体检结论" prop="verDict">
              <el-input v-model="params.verDict" placeholder="请输入体检结论" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="主检医师工号" prop="mhkdctno">
              <el-input v-model="params.mhkdctno" placeholder="请输入主检医师工号" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="主检医师" prop="mhkDct">
              <el-input v-model="params.mhkDct" placeholder="请输入主检医师" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">

            <el-form-item label="体检类型编码" prop="bhkType">
              <el-select v-model="params.bhkType" placeholder="请选择体检类型编码" style="width: 100%;" >
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="主检判定日期" prop="jdgdat">
              <el-input v-model="params.jdgdat" placeholder="请输入主检判定日期" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="报告出具日期" prop="rptPrintDate">
              <el-input v-model="params.rptPrintDate" placeholder="请输入报告出具日期" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="报告上传日" prop="createDate">
              <el-input v-model="params.createDate" placeholder="请输入报告上传日" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="接害因素" prop="badRsn">
              <el-input v-model="params.badRsn" placeholder="请输入接害因素" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="是否为复检 0：正常1：复检" prop="ifRhk">
              <el-input v-model="params.ifRhk" placeholder="请输入是否为复检 0：正常1：复检" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="复检对应的上次体检编号" prop="lastBhkCode">
              <el-input v-model="params.lastBhkCode" placeholder="请输入复检对应的上次体检编号" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">

            <el-form-item label="人员类型  1：有身份证人员2：外籍人员3：无身份证人员" prop="psnType">
              <el-select v-model="params.psnType" placeholder="请选择人员类型  1：有身份证人员2：外籍人员3：无身份证人员" style="width: 100%;" >
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="其他危害因素" prop="otherBadrsn">
              <el-input v-model="params.otherBadrsn" placeholder="请输入其他危害因素" />
            </el-form-item>
          </el-col>
        </el-row>



        <el-row :gutter="15">
          <el-col :lg="8" :xl="6">
            <el-form-item label="更新人id" prop="updateId">
              <el-input v-model="params.updateId" placeholder="请输入更新人id" />
            </el-form-item>
          </el-col>



          <el-col :lg="8" :xl="6">
            <el-form-item label="删除标志" prop="delFlag">
              <el-input v-model="params.delFlag" placeholder="请输入删除标志" />
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
    </div>
    <div class="flex p-20">
      <el-button @click="sureForm('expertForm')" type="primary" v-if="!detailForm.uuid || isEdit">确认提交</el-button>
      <el-button @click="isEdit = true" type="primary" v-if="detailForm.uuid && !isEdit">编辑</el-button>
      <el-button @click="show = false">返回</el-button>
    </div>
  </div>
</template>

<script>
  export default{
    data () {
      return {
        params:{
            uuid: null,
            personnelHeathId: null,
            bhkOrganCode: null,
            bhkCode: null,
            institutionCode: null,
            zoneCode: null,
            crptName: null,
            personName: null,
            sex: null,
            idc: null,
            brth: null,
            age: null,
            isxmrd: null,
            lnkTel: null,
            dpt: null,
            wrkNum: null,
            wrkLnt: null,
            wrkLntMonth: null,
            tchBadRsnTim: null,
            tchBadRsnMonth: null,
            workName: null,
            onguardState: null,
            bhkDate: null,
            bhkRst: null,
            mhkAdv: null,
            verDict: null,
            mhkdctno: null,
            mhkDct: null,
            bhkType: null,
            jdgdat: null,
            rptPrintDate: null,
            createDate: null,
            badRsn: null,
            ifRhk: null,
            lastBhkCode: null,
            psnType: null,
            otherBadrsn: null,
            createBy: null,
            createTime: null,
            updateId: null,
            updateBy: null,
            updateTime: null,
            delFlag: null,
        },
        rules: {
                personnelHeathId: [
                { required: true, message: "体检报告主键id不能为空", trigger: "blur" }
              ],
        }
      }
    },
    props: {
      editVisible: {
        type: Boolean,
        default: () => {
          return false
        }
      },
      detailForm: {
        type: Object,
        default: () => {
          return {}
        }
      },
      isEdit:{
        type:Boolean,
        default:()=>{
          return false
        }
      },
    },
    watch:{

    },
    computed: {
      show: {
        get () {
          return this.editVisible
        },
        set (val) {
          this.$emit('update:editVisible', val)
        }
      },
    },
    created () {
      if(this.detailForm.uuid){
        this.params = {...this.detailForm}
      }
    },
    methods: {
      // 确认
      sureForm(formName) {
        this.$refs [formName].validate((valid) => {
          if (valid) {
            if(this.detailForm.uuid){
              this.$emit('submitForm', this.params,this.detailForm.uuid)
            }else{
              this.$emit('submitForm', this.params)
            }
          } else {
            console.log('error submit!!');
            return false;
          }
        });

      },
    }

  }
</script>

<style scoped="scoped" lang="scss">
  .titile_txt{
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: bold;
    font-size: 16px;
    color: #333333;
    line-height: 19px;
    margin-bottom: 15px;
  }
</style>
